home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / e_os208 / exampl10 / exampl10.asm next >
Assembly Source File  |  1996-07-31  |  3KB  |  86 lines

  1. ;╔══════════════════════════════════════════════════════════════════════════╗
  2. ;║                                                                          ║
  3. ;║ This example show how to play a sample                                   ║
  4. ;║                                                                          ║
  5. ;║ Tabs : 13 21 29 37                                                       ║
  6. ;║                                                                          ║
  7. ;╚══════════════════════════════════════════════════════════════════════════╝
  8.  
  9. Locals
  10. .386
  11. CODE32 SEGMENT PUBLIC PARA 'CODE' USE32
  12. ASSUME  CS:CODE32,DS:CODE32,ES:CODE32
  13.  
  14. INCLUDE ..\RESOURCE\EOS.INC
  15.  
  16. Module_Name db '..\data\testsmpl.mod',0
  17.  
  18. Msg_Module  db '    ■ Module Not Found...',13,10,36
  19. Msg_Playing db '    ■ Press Space to play a sample...',13,10,36
  20.  
  21.  
  22. Start32:
  23.             mov ah,Use_Int_09       ; Use Internal Keyboard handler to use keyboard
  24.             mov bx,On
  25.             Int_EOS
  26.  
  27.             mov ah,Detect_Sound_Card
  28.             xor bx,bx               ; Find the Best One (Gravis ;))
  29.             mov cx,1                ; Display the results
  30.             Int_EOS                 ; You must use this function before using
  31.                                     ; the player
  32.  
  33.             mov ah,Load_Module
  34.             mov al,0                ; Normal Load
  35.             mov bx,44000            ; Set Replay Rate For SB
  36.             mov edx,O Module_Name
  37.             Int_EOS
  38.             jnc Load_Ok             ; Can Load ??
  39.  
  40.             mov ah,Exit_Error       ; No Exit with Exit_Error function
  41.             mov edx,O Msg_Module    ; en Display Message
  42.             Int_EOS
  43. Load_Ok:
  44.  
  45.             mov ah,Play_Module      ; Start playing module
  46.             Int_EOS
  47.             mov [Master_Volume],63          ; Set Music Volume
  48.             mov [Master_Sample_Volume],63   ; Set Sample Volume
  49.  
  50.             mov ah,9                ; Display Message
  51.             mov edx,O Msg_Playing
  52.             int 21h
  53.  
  54. @@again:
  55.             cmp Key_Map[Escape],On  ; Escape ?
  56.             je @@end
  57.             cmp Key_Map[Space],On   ; Space ?
  58.             jne @@again
  59.  
  60.             mov ah,Play_Sample
  61.             mov cx,339              ; Freq.
  62.             mov dx,08               ; Piste 8
  63.             mov bx,09h              ; Sample number
  64.             Int_EOS
  65.  
  66. @@wait:
  67.             cmp Key_Map[Space],Off  ; Space ?
  68.             jne @@wait
  69.  
  70.             jmp @@again
  71.  
  72. @@end:
  73.             mov ah,Stop_Module      ; Stop  playing module
  74.             Int_EOS
  75.  
  76.             mov ah,Clear_Module     ; Unload module From memory
  77.             Int_EOS
  78.  
  79.             mov ax,4c00h            ; Exit with error code 0
  80.             int 21h
  81.  
  82.  
  83.             CODE32 ENDS
  84.  
  85.             END
  86.